<html>
<head>
    <title>公式时间表类型</title>

    <link href="/static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="/static/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="/static/css/animate.css" rel="stylesheet"/>
    <link href="/static/css/style.css" rel="stylesheet"/>
    <link href="/static/css/common-ui.css" rel="stylesheet"/>
    <link href="/static/js/jquery-layout/jquery.layout-latest.css" rel="stylesheet"/>
</head>

<body>

<div class="container-div ui-layout-center">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="user-form">
            </form>
        </div>
        <@shiro.hasPermission name="formulatime:querymathtime:add">
            <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i> 新增
                </a>
            </div>
        </@shiro.hasPermission>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>


</body>

<script type="text/javascript" src="/static/js/jquery-1.12.4.js"></script>
<script src="/static/js/bootstrap.min.js"></script>

<!-- bootstrap-table 表格插件 -->
<script src="/static/js/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/static/js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/static/js/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<script src="/static/js/bootstrap-table/extensions/mobile/bootstrap-table-toolbar.min.js"></script>
<script src="/static/js/layer/layer.min.js"></script>
<script src="/static/js/jquery-layout/jquery.layout-latest.js"></script>
<script src="/static/js/common-ui.js?v=3.0.0"></script>
<script src="/static/js/datePicker/WdatePicker.js"></script>

<SCRIPT type="text/javascript">

    var prefix = "/com.sys/formulatime";

    var queryUrl = prefix + "/queryMathTimeList";

    $(function () {
        $('body').layout({west__size: 185});
        queryUserList();
    });

    function queryUserList() {
        var options = {
            url: queryUrl,
            detailUrl: prefix + "/selectone/{id}",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            sortName: "id",
            sortOrder: "asc",
            modalName: "公式",
            search: false,
            showExport: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '编号',
                    visible: true
                },
                {
                    field: 'typeName',
                    title: '类别名称'
                },
                {
                    field: 'typeNameZh',
                    title: '类别名称中文',
                },
                {
                    field: 'sort',
                    title: '排序'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: statusTypeFormatter
                },

                {
                    field: 'remark',
                    title: '描述'
                },
                {
                    field: 'createdTime',
                    title: '创建时间'
                },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        <@shiro.hasPermission name="formulatime:querymathtime:edit">
                        actions.push('<a class="btn btn-success btn-xs" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="formulatime:querymathtime:selectone">
                        actions.push('<a class="btn btn-success btn-xs" href="#" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="formulatime:querymathtime:remove">
                        actions.push('<a class="btn btn-danger btn-xs" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        </@shiro.hasPermission>
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }


    $("#btn-search").click(function () {
        $.table.search();
    });


    function statusTypeFormatter(cellvalue, options, rowObject) {
        if (cellvalue == 'Y') {
            return '有效';
        } else if (cellvalue == 'N') {
            return '无效';
        }

        return '';
    }

</SCRIPT>
</html>

